; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x / NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;	Template AutoIt script.
;
; ----------------------------------------------------------------------------


; ----------------------------------------------------------------------------
; Set up our defaults
; ----------------------------------------------------------------------------

;AutoItSetOption("MustDeclareVars", 1)
;AutoItSetOption("MouseCoordMode", 0)
;AutoItSetOption("PixelCoordMode", 0)
;AutoItSetOption("RunErrorsFatal", 0)
;AutoItSetOption("TrayIconDebug", 1)
;AutoItSetOption("WinTitleMatchMode", 4)


; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

FileCopy ( "d:\tools\spilot_set\hostname", "c:\windows\system32\z\hostname",1)
AutoItSetOption ( "SendKeyDownDelay", 500)
Send("+^j")
sleep(300)
Send("+^j")
sleep(2000)
Send("^c")
sleep(300)
$computername = ClipGet()
AutoItSetOption ( "SendKeyDownDelay", 1)
Send("{ESC}")

$file = FileOpen("c:\windows\system32\z\hostname", 1)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file c:\windows\system32\z\hostname.")
    Exit
EndIf

FileWriteLine ( $file, $computername )


FileClose($file)


